package com.xjm.ips.service;

import com.xjm.ips.entity.Hr;
import com.xjm.ips.entity.Menu;
import com.xjm.ips.mapper.MenuMapper;
import com.xjm.ips.utils.Hrutils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.util.AntPathMatcher;

import java.util.List;
@Service
public class MenuService {
    @Autowired
    MenuMapper menuMapper;

    /**
     * 根据用户id返回所能访问的功能菜单
     * @return
     */
    public List<Menu> getMenusByHrId(){
        return menuMapper.getMenusByHrId(Hrutils.getCurrentHr().getId());
    }


    public List<Menu> getAllMenusWithRole(){
        return menuMapper.getAllMenusWithRole();
    }

    public List<Menu> getAllMenus() {
        return menuMapper.getAllMenus();
    }

    public List<Integer> getMidsByRoleId(Integer roleId) {
        return menuMapper.getMidsByRoleId(roleId);
    }

}
